<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        //
        Schema::table('users', function (Blueprint $table) {
            $table->integer('token_expire')->default(7200)->comment('token过期时间')->after('remember_token');
            $table->tinyInteger('status')->default(1)->comment('状态, 1:正常, 2:禁用')->after('token_expire');
            $table->timestamp('last_login_at')->nullable()->comment('最后登录时间')->after('status');
            $table->string('last_login_ip', 15)->nullable()->comment('最后登录IP')->after('last_login_at');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        //
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('token_expire');
            $table->dropColumn('status');
        });
    }
};
